{template 'yp', 'header'}
<!--main-->
<div class="main clear">
	<div class="crumbs" style="margin-bottom:0"><a href="{APP_PATH}">首页</a><span> &gt; </span><a href="{get_yp_url()}">企业黄页</a> &gt; <a href="{get_yp_url('model', $modelid)}">产品</a> &gt; 列表</div>
    <div class="box cat-data" id="PropSingle">
    	<div class="choosed"><strong class="ib">您已选择:</strong>{if is_array($parent_url) && !empty($parent_url)}<a href="{$parent_url['url']}" class="">{$parent_url['title']}</a>{/if}{loop $filter $fil}<a href="{$fil['url']}">{$fil['title']}</a>{/loop}</div>
		{if $cat_arr}
    	<dl class="clear">
        	<dt><strong>分类：</strong></dt>
            <dd class="AttrBox clear">
			{php $fdata = yp_filters('catid',$modelid,$cat_arr,0);}
			{loop $fdata $r}
				{$r[menu]}
			{/loop}
			</dd>
        </dl> 
		{/if}
		<dl class="clear">
			<dt><strong>价格：</strong></dt>
			<dd class="AttrBox clear">
			{php $price_rang = array('500元以下|1_500','500-1000元|500_1000','1000-1500元|1000_1500','1500-2000元|1500_2000','2000-3000元|2000_3000','3000-4500元|3000_4500','4500元以上|4500_20000')}
			{loop yp_filters('price',$modelid,$price_rang) $r}
				{$r[menu]}
			{/loop}
			</dd>
        </dl>
		{php $areaid = intval($_GET['areaid']); $linkage_data = yp_show_linkage(1, 'areaid', $areaid, $modelid);}
		{if $linkage_data}
		<dl class="clear">
        	<dt><strong>产地：</strong></dt>
            <dd class="AttrBox clear">
			{loop $linkage_data $r}
				<a href="{$r['url']}">{$r['title']}</a> 
			{/loop}
			</dd>
        </dl> 
		{/if}
    </div>
    <div class="col-left picbig">
    	<div class="category-main box generic info-content" id="checkbox">
        	<div class="title">
                <div class="orderby-select mouseover" type="select" heights="23" position="0">
                	<div class="select">{if $_GET['order']=='3'} <a class="up" >更新时间升序</a>{elseif $_GET['order']=='4'} <a class="down" >更新时间降序</a>{elseif $_GET['order']=='1'} <a class="up" >价格由低到高</a>{elseif $_GET['order']=='2'} <a class="down" >价格由高到低</a>{else}<a class="null" >请选择排序方式</a>{/if}</div>
                    <ul class="selectlist subselect_0" style="display:none;">
						<li><a class="null" onclick="javascript:void(0);">请选择排序方式</a></li>
						<li><a class="up" href="{$current_url}&order=1">价格由低到高</a></li>
                        <li><a class="down" href="{$current_url}&order=2">价格由高到低</a></li>
						<li><a class="up" href="{$current_url}&order=3">更新时间升序</a></li>
                        <li><a class="down" href="{$current_url}&order=4">更新时间降序</a></li>
					</ul>
                </div>
				<strong>产品信息</strong>
			</div>
            <ul class="info-top">
            	<li class="cp"></li>
            	<li class="pic"></li>
                <li class="jiage">价格</li>
                <li class="vip">诚信</li>
                <li class="info">信息/公司</li>
            </ul>
			{php $sql = yp_filters_sql($modelid);$y=1;$listorder = array(1=>'price ASC', 'price DESC', 'updatetime ASC', 'updatetime DESC');}
			{php $order = $_GET['order'] ? $listorder[intval($_GET['order'])] : 'updatetime DESC'}
			{pc:yp action="position" posid="$posid" modelid="$modelid" catid="$catid" order="listorder asc" num="4" expiration="1"}
			{loop $data $r}
			 {php $userid = get_memberinfo_buyusername($r['username'], 'userid');$memberinfo = get_companyinfo($userid, 'companyname, publish_total, url');$publish_total = string2array($memberinfo['publish_total']);}
            <ul class="info-item clear"{if $y==1} style="border-top:none"{/if}>
            	{if $last_cat}<li class="cp"><label><input type="checkbox" value="{$r[id]}" title="{$r[title]}" img="{$r[thumb]}" id="c_{$r[id]}" name="moderate[]">对比</label></li>{/if}
				<li class="pic"><div class="img-wrap">
					<a href="{$r[url]}" title="{$r[title]}"><img src="{$r[thumb]}" title="{$r[title]}"></a></div>
				</li>
                <li class="jiage"><strong>&yen;{$r['price']}</strong></li>
                <li class="vip">{get_company_rank($r['userid'])}</li>
                <li class="info">
                    <h2><a href="{$r[url]}" title="{$r[title]}">{$r[title]}</a></h2>
                    <p>商家：<a href="{$memberinfo['url']}" target="_blank" class="blue">{$memberinfo['companyname']}</a><br />
					该商家共有 {$publish_total[$modelid]} 条此类产品信息<br />
                       更新日期：{date("Y-m-d",$r[updatetime])}
					</p>
                </li>
			</ul>
			{php $y++;}
				{/loop}
			{/pc}
			
			{php $urlrule = yp_makeurlrule();}
			{pc:yp action="lists" where="$sql" modelid="$modelid" order="$order" num="16" page="$page" urlrule="$urlrule"}
			{loop $data $r}
			 {php $memberinfo = get_companyinfo($r['userid'], 'companyname, publish_total, url');$publish_total = string2array($memberinfo['publish_total']);}
			<ul class="info-item clear"{if $y==1} style="border-top:none"{/if}>
            	{if $last_cat}<li class="cp"><label><input type="checkbox" value="{$r[id]}" title="{$r[title]}" img="{$r[thumb]}" id="c_{$r[id]}" name="moderate[]">对比</label></li>{/if}
				<li class="pic"><div class="img-wrap">
					<a href="{$r[url]}" title="{$r[title]}"><img src="{$r[thumb]}" title="{$r[title]}"></a></div>
				</li>
                <li class="jiage"><strong>&yen;{$r['price']}</strong></li>
                <li class="vip">{get_company_rank($r['userid'])}</li>
                <li class="info">
                    <h2><a href="{$r[url]}" title="{$r[title]}">{$r[title]}</a></h2>
                    <p>商家：<a href="{$memberinfo['url']}" target="_blank" class="blue">{$memberinfo['companyname']}</a><br />
					该商家共有 {$publish_total[$modelid]} 条此类产品信息<br />
                       更新日期：{date("Y-m-d",$r[updatetime])}
					</p>
                </li>
            </ul>
			{php $y++;}
			{/loop}
			{if $pages}<div id="pages" class="text-c">{$pages}</div>{/if}
			{/pc}
         </div>
    </div>
    <div class="col-auto">
    	<div class="box box-tab fillet fillet-blue">
        	<ul class="tab clear swap-tab cu-li">
            	<li class="on">推荐产品</li>
                <li>最新产品</li>
            </ul>
        	<div class="swap-content">
				{pc:yp action="position" posids="$this->global_posid" modelid="$modelid" order="listorder asc" num="10" expiration="1"}
	            <ul class="list-num">
				 {loop $data $r}
		            <li><em{if $n<4} class="n{$n}"{/if}>{$n}</em><a href="{$r['url']}">{str_cut($r['title'], 30)}</a></li>
		         {/loop}
		        {/pc}
	            </ul>
	        	<ul class="list-num" style="display:none;">
	             {pc:yp action="lists" modelid="$modelid" order="id DESC" num="10"}
	         	  {loop $data $r}
		            <li><em{if $n<4} class="n{$n}"{/if}>{$n}</em><a href="{$r['url']}">{str_cut($r['title'], 30)}</a></li>
			      {/loop}
	             </ul>
				 {/pc}
             </div>
            <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span>
        </div>
    	<div class="bk10"></div>
        <div class="box box-tab fillet fillet-blue">
        	<ul class="tab clear swap-tab cu-li">
            	<li class="on">24小时热点商机</li>
                <li>周热点商机</li>
            </ul>
        	<div class="swap-content">
			{php $buy_type = $this->buy_type;}
			{pc:yp action="hits" modelid="$this->setting_models[76]" day="1"}
         	<ul class="list-num">
				{loop $data $r}
					<li><em{if $n<4} class="n{$n}"{/if}>{$n}</em><a href="{yp_filters_url('tid', array('tid'=>$r['tid'], 'catid'=>$r['catid']), 2, $this->setting_models[76])}" class="blue" target="_blank">[{$buy_type[$r['tid']]}]</a> <a href="{$r['url']}">{str_cut($r['title'], 30)}</a></li>
				{/loop}
            </ul>
			{/pc}
            {pc:yp action="hits" modelid="$this->setting_models[76]" order="weekviews DESC"}
            <ul class="list-num" style="display:none;">
				{loop $data $r}
					<li><em{if $n<4} class="n{$n}"{/if}>{$n}</em><a href="{yp_filters_url('tid', array('tid'=>$r['tid'], 'catid'=>$r['catid']), 2, $this->setting_models[76])}" class="blue" target="_blank">[{$buy_type[$r['tid']]}]</a> <a href="{$r['url']}">{str_cut($r['title'], 30)}</a></li>
				{/loop}
            </ul>
			{/pc}
             </div>
            <span class="o1"></span><span class="o2"></span><span class="o3"></span><span class="o4"></span>
        </div>
    </div>
</div>
<script type="text/javascript">
var t_box = $("#checkbox :checkbox");
var modelid = '{$modelid}';
var catid = '{$catid}';
var ajax_url = '{APP_PATH}index.php';
var funbox = function () {
	var comparison =$("#comparison");
	if(comparison.length==0){
		$.getScript("{JS_PATH}comparison.js",function(){
			t_box.each(function(){
				var q = $(this)
				if(q.attr("checked")==true){
					var id = q.val(),
						title = q.attr('title'),
						img = q.attr('img'),
						sid = 'v1'+id,
						str = "<li id='"+sid+"'><img src="+img+" height='45' /><p>"+title+"</p><a href='javascript:;' class='close' onclick=\"remove_relation('"+sid+"',"+id+")\">X</a></li>";
						$.get(ajax_url, {m:'yp', c:'index', a:'pk', action:'add', id:id, title:title, thumb:img, catid:catid, random:Math.random()});
						$('#relation_text').append(str);
						$('#relation').val(id);
				}
			});
		});
	}else{
		t_box.unbind("click", funbox);
	}
};
t_box.bind("click", funbox);
t_box.attr("checked",false);
$.get(ajax_url, {m:'yp', c:'index', a:'pk', action:'get', catid:catid, random:Math.random()}, function(data) {
	if (data) {
		$.getScript("{JS_PATH}comparison.js",function(){
			var obj = eval('(' + data + ')');
			for(var i in obj) {
				var id = obj[i].id,
				relation_ids = $('#relation').val(),
				title = obj[i].title,
				img = obj[i].thumb,
				sid = 'v1'+id,
				str = "<li id='"+sid+"'><img src="+img+" height='45' /><p>"+title+"</p><a href='javascript:;' class='close' onclick=\"remove_relation('"+sid+"',"+id+")\">X</a></li>";
				$('#'+sid+' img').LoadImage(true, 120, 60,'statics/images/s_nopic.gif');
				if(relation_ids =='' ){
					$('#relation').val(id);
				}else{
					relation_ids = relation_ids+'-'+id;
					$('#relation').val(relation_ids);
				}
				$('#relation_text').append(str);
			}
			c_sum();
		});
	}
});

$.get(ajax_url, {m:'yp', c:'index', a:'get_buycar', random:Math.random()},function(data){
	var obj = eval('(' + data + ')');
	if (obj.num) {
		$('#buy_show').show();
		$('#buy_show_num').html(obj.num);
		$('#relation_text img').LoadImage(true, 120, 60,'statics/images/s_nopic.gif');
	}
});
</script>
{template 'yp', 'footer'}